package com.itheima.define;

public class MethodTest4 {
    public static void main(String[] args) {
        //求1-n的和，n为参数值
        int rs = add(5);
        System.out.println(rs);

        int rs2 = add(10);
        System.out.println(rs2);

        System.out.println("**********");

        jubge(10);
        jubge(7);

        System.out.println("**********");


    }

    public static void jubge(int number){
        if(number % 2== 0){
            System.out.println(number+"是一个偶数");
        }else{
            System.out.println(number+"是一个奇数");
        }
    }


    public static int add(int n) {
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += i;
        }
        return sum;
    }


}